/*
 * SortedPacketQueue.h
 *
 *  Created on: 2019-04-02
 *      Author: chuanjiang.zh
 */

#ifndef SORTEDPACKETQUEUE_H_
#define SORTEDPACKETQUEUE_H_

#include "MediaPacket.h"
#include "TSortedList.h"

namespace av
{

struct MediaPacketPtsOrder : public std::binary_function< MediaPacketPtr, MediaPacketPtr, bool >
{
    bool operator ()(const MediaPacketPtr& l, const MediaPacketPtr& r) const
    {
        return l->pts < r->pts;
    }
};

struct MediaPacketDurationOrder : public std::binary_function< MediaPacketPtr, MediaPacketPtr, bool >
{
    bool operator ()(const MediaPacketPtr& l, const MediaPacketPtr& r) const
    {
        return l->duration < r->duration;
    }
};


typedef comn::SortedList< MediaPacketPtr, MediaPacketPtsOrder >        PtsSortedPacketQueue;

typedef comn::SortedList< MediaPacketPtr, MediaPacketPtsOrder >        DurationSortedPacketQueue;


}

#endif /* SORTEDPACKETQUEUE_H_ */
